<template>
<view class="version">
    <uni-nav-bar 
      :status-bar="true" 
      background-color="linear-gradient(90deg, rgba(255,255,255,1) 0%, rgba(245,250,255,1) 100%)"
      left-icon="left"
      title="版本信息"
      color="#1a1a1a"
      @clickLeft="back"
    />
    
    <view class="content">
      <view class="section">
        <view class="info-card">
          <view class="info-item">
            <text class="label">当前版本</text>
            <text class="value">1.0.0</text>
          </view>
          
          <view class="info-item">
            <text class="label">更新日期</text>
            <text class="value">2025-01-01</text>
          </view>
          
          <view class="info-item">
            <text class="label">更新内容</text>
            <view class="update-list">
              <view class="update-item" v-for="(item, index) in updateList" :key="index">
                <uni-icons type="checkmark" size="16" color="#64b5f6"></uni-icons>
                <text>{{ item }}</text>
              </view>
            </view>
          </view>

          <view class="info-item">
            <text class="label">更新进度</text>
            <view class="progress-bar">
              <view class="progress" :style="{width: progress + '%'}"></view>
            </view>
            <text class="progress-text">{{ progress }}%</text>
          </view>

          <view class="history-card">
            <text class="history-title">版本历史</text>
            <view class="history-list">
              <view class="history-item" v-for="(item, index) in historyList" :key="index">
                <view class="version-tag">v{{ item.version }}</view>
                <text class="date">{{ item.date }}</text>
                <view class="history-content">
                  <text v-for="(content, i) in item.contents" :key="i">• {{ content }}</text>
                </view>
              </view>
            </view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      progress: 75,
      updateList: [
        '新增版本信息页面',
        '优化系统性能',
        '修复已知问题',
        '提升用户体验'
      ],
      historyList: [
        {
          version: '1.0.0',
          date: '2025-01-01',
          contents: [
            '新增版本信息页面',
            '优化系统性能'
          ]
        },
        {
          version: '0.9.0', 
          date: '2024-12-15',
          contents: [
            '新增设置页面',
            '优化通知系统'
          ]
        },
        {
          version: '0.8.0',
          date: '2024-11-30',
          contents: [
            '新增个人中心',
            '优化UI设计'
          ]
        }
      ]
    }
  },
  methods: {
    back() {
      uni.navigateBack()
    }
  },
  onBackPress() {
    uni.switchTab({
      url: '/pages/mine/index'
    })
    return true
  }
}
</script>

<style scoped lang="scss">
.version {
  min-height: 100vh;
  padding: 24px;
  padding-top: calc(env(safe-area-inset-top) + 16px);
  background: linear-gradient(180deg, rgba(100,181,246,0.05) 0%, rgba(255,255,255,1) 100%);
  position: relative;
  overflow: hidden;
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 300px;
    background: linear-gradient(180deg, rgba(100,181,246,0.1) 0%, rgba(100,181,246,0) 100%);
    z-index: 0;
  }
  
  .content {
    margin-top: calc(env(safe-area-inset-top) + 16px);
    padding-top: 8px;
    position: relative;
    z-index: 1;
  }
  
  .info-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 28px;
    padding: 24px;
    box-shadow: 0 6px 32px rgba(100,181,246,0.08);
    border: 1px solid rgba(100,181,246,0.12);
  }
  
  .info-item {
    margin-bottom: 24px;
    
    .label {
      display: block;
      font-size: 14px;
      color: #666;
      margin-bottom: 4px;
    }
    
    .value {
      font-size: 16px;
      font-weight: 500;
      color: #1a1a1a;
      position: relative;
      display: inline-block;
      padding: 8px 16px;
      background: linear-gradient(135deg, rgba(100,181,246,0.1), rgba(100,181,246,0.05));
      border-radius: 12px;
      border: 1px solid rgba(100,181,246,0.15);
      box-shadow: 0 2px 8px rgba(100,181,246,0.08);
      transition: all 0.3s ease;
      
      &:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(100,181,246,0.12);
      }
    }
  }
  
  .update-list {
    .update-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 0;
      
      text {
        font-size: 14px;
        color: #333;
      }
    }
  }

  .progress-bar {
    height: 12px;
    background: rgba(100,181,246,0.1);
    border-radius: 6px;
    margin: 8px 0;
    overflow: hidden;
    position: relative;
    
    &::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: linear-gradient(90deg, 
        rgba(100,181,246,0.2) 0%,
        rgba(100,181,246,0.1) 50%,
        rgba(100,181,246,0.2) 100%
      );
      background-size: 200% 100%;
      animation: progress-bg 2s linear infinite;
    }
    
    .progress {
      height: 100%;
      background: linear-gradient(90deg, #64b5f6, #90caf9);
      border-radius: 6px;
      transition: width 0.3s ease;
      position: relative;
      z-index: 1;
      box-shadow: 0 2px 4px rgba(100,181,246,0.2);
    }
  }

  @keyframes progress-bg {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }

  .progress-text {
    font-size: 14px;
    color: #666;
    text-align: right;
  }

  .history-card {
    margin-top: 24px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    border-radius: 28px;
    box-shadow: 0 12px 48px rgba(100,181,246,0.12);
    border: 1px solid rgba(100,181,246,0.15);
    transition: all 0.3s ease;
    
    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 16px 56px rgba(100,181,246,0.16);
    }
    
    .history-title {
      font-size: 20px;
      font-weight: 600;
      color: #1a1a1a;
      margin-bottom: 24px;
      position: relative;
      
      &::after {
        content: '';
        position: absolute;
        left: 0;
        bottom: -8px;
        width: 80px;
        height: 4px;
        background: linear-gradient(90deg, #64b5f6 0%, #90caf9 100%);
        border-radius: 2px;
        opacity: 0.8;
      }
    }
    
    .history-list {
      position: relative;
      padding-left: 24px;
      
      &::before {
        content: '';
        position: absolute;
        left: 8px;
        top: 8px;
        bottom: 8px;
        width: 2px;
        background: rgba(100,181,246,0.2);
        border-radius: 2px;
      }
    }
    
  .history-item {
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(100,181,246,0.08);
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
    
    &::after {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: linear-gradient(135deg, 
        rgba(100,181,246,0.05) 0%,
        rgba(100,181,246,0.02) 50%,
        rgba(100,181,246,0.05) 100%
      );
      opacity: 0;
      transition: opacity 0.3s ease;
    }
    
    &:hover {
      transform: translateX(4px);
      box-shadow: 0 6px 24px rgba(100,181,246,0.12);
      
      &::after {
        opacity: 1;
      }
    }
      
      &::before {
        content: '';
        position: absolute;
        left: -24px;
        top: 24px;
        width: 12px;
        height: 12px;
        background: #64b5f6;
        border: 2px solid #fff;
        border-radius: 50%;
        z-index: 1;
      }
      
      .version-tag {
        display: inline-block;
        padding: 6px 12px;
        background: linear-gradient(135deg, #64b5f6, #90caf9);
        color: #fff;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 500;
        margin-right: 12px;
        box-shadow: 0 2px 8px rgba(100,181,246,0.2);
      }
      
      .date {
        font-size: 13px;
        color: #666;
        background: rgba(100,181,246,0.08);
        padding: 4px 8px;
        border-radius: 4px;
      }
      
      .history-content {
        margin-top: 12px;
        padding-left: 24px;
        
        text {
          display: flex;
          align-items: center;
          gap: 8px;
          font-size: 14px;
          color: #333;
          line-height: 1.6;
          margin-bottom: 8px;
          
          &::before {
            content: '•';
            color: #64b5f6;
            font-size: 18px;
          }
        }
      }
    }
  }
}
</style>
